from jms.ods import jms_ods__yl_oms_oms_waybill, \
    jms_ods__yl_cn_mysql_lmdm_sys_second_code, \
    jms_ods__yl_cn_mysql_lmdm_sys_tail_dispatch_area,\
    jms_ods__yl_cn_mysql_lmdm_sys_tail_dispatch_area_staff
from utils.operators.latest_only_spark_submit_operator import LatestOnlySparkSubmitOperator

jms_dwd__dwd_cn_address_warehouse_day_dt = LatestOnlySparkSubmitOperator(
    task_id='jms_dwd__dwd_cn_address_warehouse_day_dt',
    conn_id='spark_default',
    pool_slots=4,
    # depends_on_past=True,  # 如果任务依赖于前一天的同名任务，则将 depends_on_past 设为 True
    task_concurrency=1,  # 如果任务不支持并发，则将 task_concurrency 设为 1
    name='jms_dwd__dwd_cn_address_warehouse_day_dt_{{ execution_date | cst_ds }}',  # yarn 任务名称
    driver_memory='4G',
    executor_memory='8G',
    executor_cores=5,
    num_executors=10,
    email=['yushuo@jtexpress.com','yl_bigdata@yl-scm.com'],
    conf={'spark.executor.memoryOverhead': 2048,
          'spark.core.connection.ack.wait.timeout': 3000,
          'spark.default.parallelism': 600,
          'spark.locality.wait': 60,
          },
    java_class='com.yunlu.bigdata.jobs.jmsthreecode.SignedWaybillAddress',  # spark 主类
    # application='hdfs:///user/spark/work/dwd/dwd_cn_address_warehouse_day_dt/jobs-1.0-SNAPSHOT-jar-with-dependencies.jar',
    application='hdfs:///scheduler/jms/spark/lyx/dwd_cn_address_warehouse_day_dt/jobs-1.0-SNAPSHOT-jar-with-dependencies.jar',
    # spark jar 包
    application_args=['{{ execution_date | cst_ds_nodash }}'],  # 参数dt 20201026
)

# 设置依赖
jms_dwd__dwd_cn_address_warehouse_day_dt << [
    jms_ods__yl_oms_oms_waybill,
    jms_ods__yl_cn_mysql_lmdm_sys_second_code,
    jms_ods__yl_cn_mysql_lmdm_sys_tail_dispatch_area,
    jms_ods__yl_cn_mysql_lmdm_sys_tail_dispatch_area_staff, ]
